/* 
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */


var fieldName = ['id', 'deviceNo', 'modelId', 'adminAreaCode', 'installSite', 'mobileNo', 'uniqueCode', 'pointId', 'pointName', 'runTime', 'checkTime', 'expireTime', 'status',
    'note', 'updateTime', 'createTime', 'orgCode', 'model', 'commTypeName', 'manufactoryName', 'produceTime', 'channel', 'zbm', 'company', 'subCompany', 'shortName',
    'pointType', 'pointType2', 'name', 'terminalNo', 'reportNo', 'checkResult', 'voltage', 'lowerLimit', 'upperLimit', 'ip', 'port', "reportStatusCh", "startStatusCh"];
var fieldLabel = ['ID', '设备编号', '终端型号ID', '区域码', '安装地点', '手机号码', '唯一码', '监测点ID', '监测点名称', '投运日期', '检测日期', '有效期', '状态',
    '备注', '更新日期', '创建日期', '机构编码', '型号', '通信方式', '生产厂家', '出厂日期', '通道', '组编码', '供电局', '部门分县局', '供电所',
    '监测点类型', '电网类型', '监测点名称', '终端编号', '报告编号', '检验结果', '电压等级', '电压下限', '电压上限', 'IP地址', '端口'];


var _pageSize = 20;
var now = new Date();

var store = new Ext.data.JsonStore({
    url: "../../servlet/system/PointLoad",
    root: 'data',
    idProperty: 'id',
    totalProperty: 'count',
    fields: fieldName,
    autoLoad: true,
    baseParmas: {cmd: "expireWarn", reportStatus: -1, range: -1, start: 0, limit: _pageSize}
});

var grid = new Ext.grid.GridPanel({
    title: '装置超期未校验告警',
    store: store,
    columns: [
        {header: fieldLabel[0], sortable: true, dataIndex: fieldName[0], hidden: true},
        {header: '供电局', width: 100, sortable: true, dataIndex: 'company'},
        {header: '部门分县局', width: 100, sortable: true, dataIndex: 'subCompany'},
        {header: '供电所', width: 100, sortable: true, dataIndex: 'shortName'},
        {header: '监测点名称', width: 100, sortable: true, dataIndex: 'name'},
        {header: '终端编号', width: 80, sortable: true, dataIndex: 'terminalNo'},
        {header: '区域码', width: 100, sortable: true, dataIndex: 'adminAreaCode'},
        {header: '组编码', width: 100, sortable: true, dataIndex: 'zbm'},
        {header: '电压等级', width: 100, sortable: true, dataIndex: 'voltage', align: 'right'},
        {header: '电压上限', width: 100, sortable: true, dataIndex: 'upperLimit', xtype: 'numbercolumn', format: '0.00', align: 'right'},
        {header: '电压下限', width: 100, sortable: true, dataIndex: 'lowerLimit', xtype: 'numbercolumn', format: '0.00', align: 'right'},
        {header: '检测日期', width: 80, sortable: true, dataIndex: 'checkTime', xtype: 'datecolumn', format: 'Y-m-d'},
        {header: '有效期', width: 80, sortable: true, dataIndex: 'expireTime', xtype: 'datecolumn', format: 'Y-m-d', css: 'color:orange;'},
        {header: '报告编号', width: 80, sortable: true, dataIndex: 'reportNo', hidden: true},
        {header: '检验结果', width: 100, sortable: true, dataIndex: 'result', hidden: true},
        {header: '监测点类型', width: 100, sortable: true, dataIndex: 'pointType'},
        {header: '电网类型', width: 100, sortable: true, dataIndex: 'pointType2'},
        {header: '安装地点', width: 80, sortable: true, dataIndex: 'installSite'},
        {header: 'IP地址', width: 120, sortable: true, dataIndex: 'ip'},
        {header: '端口', width: 80, sortable: true, dataIndex: 'port'},
        {header: '通信类型', width: 80, sortable: true, dataIndex: 'commTypeName'},
        {header: '设备编号', width: 100, sortable: true, dataIndex: 'deviceNo'},
        {header: '型号', width: 80, sortable: true, dataIndex: 'model'},
        {header: '生产厂家', width: 100, sortable: true, dataIndex: 'manufactoryName'},
        {header: '投运日期', width: 80, sortable: true, dataIndex: 'runTime', xtype: 'datecolumn', format: 'Y-m-d'},
        {header: '出厂日期', width: 80, sortable: true, dataIndex: 'produceTime', xtype: 'datecolumn', format: 'Y-m-d'},
        {header: '启用', width: 80, sortable: true, dataIndex: "startStatusCh"},
        {header: '上报', width: 80, sortable: true, dataIndex: "reportStatusCh"},
        {header: '备注', width: 80, sortable: true, dataIndex: 'note'}
    ],
    loadMask: true,
    tbar: new Ext.Toolbar([
        rangeCombo,
        reportCombo,
        '-',
        {
            xtype: 'button',
            text: '搜索',
            iconCls: 'icon-search',
            width: 60,
            style: {marginLeft: '20px'},
            handler: function() {
                store.reload();
            }
        }
    ]),
    bbar: new Ext.PagingToolbar({
        pageSize: _pageSize,
        store: store,
        displayInfo: true,
        displayMsg: '显示记录：{0} - {1}   总记录：{2}',
        emptyMsg: '目前没有信息'
    })
});


function buildWindow() {
    var applicationUI = new Ext.Viewport({
        layout: 'fit',
        items: [
            grid
        ]
    });
    store.baseParams.cmd = "expireWarn";
    store.baseParams.start=0;
    store.baseParams.limit = _pageSize;
    store.load({cmd: "expireWarn", reportStatus: -1, range: -1, start: 0, limit: _pageSize});
}
Ext.onReady(buildWindow); 